import request from '@/utils/request'

export const categoryList = params => {
  return request({
    url: '/admin/wecom/category/list',
    method: 'get',
    params
  })
}

export const editlink = data => {
  return request({
    url: '/admin/linkmanage/editLinkMaterial',
    method: 'post',
    data
  })
}
//
export const categoryAdd = data => {
  return request({
    url: '/admin/wecom/category',
    method: 'post',
    data
  })
}

export const categoryEdit = data => {
  return request({
    url: '/admin/wecom/category',
    method: 'put',
    data
  })
}

export const categoryDel = params => {
  return request({
    url: '/admin/wecom/category/' + params,
    method: 'delete',
  })
}

// export const articleList = data => {
//   return request({
//     url: '/admin/wecom/material/media',
//     method: 'post',
//     data
//   })
// }
// export const articleList = params => {
//   return request({
//     url: '/admin/tag/list',
//     method: 'get',
//     params
//   })
// }
export function articleList(params) {
  return request({
    // url: '/admin/linkmanage/list',
    url: '/admin/tag/list',
    method: 'get',
    params
  })
}

//链接管理详情查询接口
export function getLinklist(params) {
  return request({
    url: 'admin/linkmanage/getDetail',
    method: 'get',
    params
  })
}


export function editTransfer(data) {
  return request({
    url: '/admin/linkmanage/editLinkMaterial',
    method: 'post',
    data
  })
}
export const upload = data => {
  return request({
    url: '/admin/wecom/material/upload',
    method: 'post',
    data
  })
}

export const uploadFile = data => {
  return request({
    url: '/admin/linkmanage/uploadFile',
    method: 'post',
    data
  })
}
//
export const creatinglinks = data => {
  return request({
    url: '/admin/linkmanage/addLinkMaterial',
    method: 'post',
    data
  })
}
export const addMaterial = data => {
  return request({
    url: '/admin/tag/addMaterial',
    method: 'post',
    data
  })
}

export const catchArticle = data => {
  return request({
    url: '/admin/wxspider/catch',
    method: 'post',
    data
  })
}

export const articleInfo = id => {
  return request({
    url: '/admin/wecom/material/' + id,
    method: 'get'
  })
}

export const articleEdit = data => {
  return request({
    url: '/admin/tag/updateMaterial',
    method: 'post',
    data
  })
}

export const articleDel = id => {
  return request({
    url: '/admin/wecom/material/' + id,
    method: 'delete'
  })
}

/**
 *
 * search
 * mediaType 5
 * categoryId
 */
export const posterList = params => {
  return request({
    url: '/admin/operate/material/list',
    method: 'get',
    params
  })
}
// 获取问卷分组删除
export const tableManageDel = params => {
  return request({
    url: '/admin/tableManage/delete',
    method: 'get',
    params
  })
}
// 获取问卷主页列表查询
export const getTableManageList = data => {
  return request({
    url: '/admin/tableManage/list',
    method: 'post',
    data
  })
}
// 问卷创建
export const addTableManage = data => {
  return request({
    url: '/admin/tableManage/add',
    method: 'post',
    data
  })
}
// 问卷创建管理机构
export const getTreeSelect = params => {
  return request({
    url: '/admin/permission/treeSelect',
    method: 'get',
    params
  })
}
// 问卷创建员工
export const getPermission = data => {
  return request({
    url: '/admin/permission',
    method: 'post',
    data
  })
}
// 问卷填写结果
export const rateCalculation = params => {
  return request({
    url: '/admin/table/option/rateCalculation',
    method: 'get',
    params
  })
}
// 问卷详情
export const formMsgQuery = params => {
  return request({
    url: '/admin/tableManage/query',
    method: 'get',
    params,
  })
}
// 问卷客戶发送详情查询
export const listQuery = params => {
  return request({
    url: '/admin/table/answering/listQuery',
    method: 'get',
    params
  })
}
// 问卷图片上传接口
export const uploadPicture = data => {
  return request({
    url: '/admin/common/uploadPicture',
    method: 'post',
    data
  })
}
// 新增分组列表
export function addGroup(data) {
  return request({
    url: '/admin/wecom/category/personal/add',
    method: 'post',
    data,
  })
}
// 新增企业分组列表
export function addGroupCorp(data) {
  return request({
    url: '/admin/wecom/category/corp/add',
    method: 'post',
    data,
  })
}
// 编辑分组
export function editGroup(data) {
  return request({
    url: '/admin/wecom/category/personal/edit',
    method: 'put',
    data,
  })
}
// 编辑企业分组
export function editGroupCorp(data) {
  return request({
    url: '/admin/wecom/category/corp/edit',
    method: 'put',
    data,
  })
}
// 删除个人分组
export function deleteGroup(id) {
  return request({
    url: "/admin/operate/material/deleteGroup" + "/" + id,
    method: "delete",
  });
}

// 删除企业分组
export function deleteGroupCorp(id) {
  return request({
    url: "/admin/operate/material/deleteGroupCorp" + "/" + id,
    method: "delete",
  });
}

//链接管理列表查询接口
export function getLinkmanage(params) {
  return request({
    url: '/admin/linkmanage/list',
    method: 'get',
    params
  })
}

//根据问卷id查询问卷详情
export function getFormManage(params) {
  return request({
    url: '/admin/tableManage/query',
    method: 'get',
    params
  })
}

//根据文件id查询文件详情
export function getFileDetails(data) {
  return request({
    url: '/admin/admin/detail/fileListQuery',
    method: 'post',
    data,
    params:{
      pageNum:data.pageNum,
      pageSize:data.pageSize,
    }
  })
}

//企业海报库编辑海报
export const articleEditCorp = data => {
  return request({
    url: '/admin/tag/corp/updateMaterial',
    method: 'post',
    data
  })
}

//企业海报库删除海报
export const articleDelCorp = id => {
  return request({
    url: '/admin/wecom/material/corp/' + id,
    method: 'delete'
  })
}

//链接管理企业库编辑
export function editTransferCorp(data) {
  return request({
    url: '/admin/linkmanage/corp/editLinkMaterial',
    method: 'post',
    data
  })
}

//链接管理企业库删除
export const categoryDelCorp1 = params => {
  return request({
    url: '/admin/linkmanage/corp/removeLinkMaterial/' + params,
    method: 'delete',
  })
}

//企业库编辑分组
export const categoryEditCorp = data => {
  return request({
    url: '/admin/wecom/category/corp/edit',
    method: 'put',
    data
  })
}

//企业库删除分组
export const categoryDelCorp = params => {
  return request({
    url: '/admin/wecom/category/corp/' + params,
    method: 'delete',
  })
}

// //企业分组编辑
// export const categoryEditCorp = data => {
//   return request({
//     url: '/admin/wecom/category/corp/edit',
//     method: 'put',
//     data
//   })
// }
//个人分组编辑
export const categoryEditPer = data => {
  return request({
    url: '/admin/wecom/category/personal/edit',
    method: 'put',
    data
  })
}

//个人库删除分组
export const categoryDelPersonal = params => {
  return request({
    url: '/admin/wecom/category/personal/' + params,
    method: 'delete',
  })
}

//个人库新增分组
export const categoryAddPersonal = data => {
  return request({
    url: '/admin/wecom/category/personal/add',
    method: 'post',
    data
  })
}

// 企业库分组添加
export const categoryAddCorp = data => {
  return request({
    url: '/admin/wecom/category/corp/add',
    method: 'post',
    data
  })
}

//个人分组添加
export const categoryAddPer = data => {
  return request({
    url: '/admin/wecom/category/personal/add',
    method: 'post',
    data
  })
}


